package com.test.Protection;


import com.test.license.LCheckThread;

/**
 * @author: zouren
 * @date: 2022/3/16
 * @description:
 */
public class Pc {
    private static Pc instance = new Pc();
    private LCheckThread checkThread = null;
    private ProtectionLTask protectionLTask = null;
    private int state = 0;

    public static Pc getInstance() {
        if (instance == null) {
            instance = new Pc();
        }
        return instance;
    }

    public final void startCheckThread(int hours) {
        if (hours > 0 && this.checkThread == null) {
            this.checkThread = new LCheckThread(hours);
            this.checkThread.start();
        }

    }

    public final void startCheckThread() {
        if (this.checkThread == null) {
            this.checkThread = new LCheckThread();
            this.checkThread.start();
        }
    }

    public final void startProtectionLTask() {
        if (this.protectionLTask == null) {
            this.protectionLTask = new ProtectionLTask();
            new Thread(protectionLTask,Constant.T_PROTECTION_TASK).start();
        }
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }
}
